• sourcecodester_scm_new.sql
  • project /
1 -- phpMyAdmin SQL Dump
2 -- version
4.8.4
3 -- https:
//www.phpmyadmin.net/
4 --
5 -- Host:
127.0.0.1
6 -- Generation Time: Dec
07, 2020 at 01:19 PM
7 -- Server version:
10.1.37-MariaDB
8 -- PHP Version:
5.6.39
9
10 SET SQL_MODE =
"NO_AUTO_VALUE_ON_ZERO";
11 SET AUTOCOMMIT =
0;
12 START TRANSACTION;
13 SET time_zone =
"+00:00";
14
15
16 /*!
40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
17 /*!
40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
18 /*!
40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
19 /*!
40101 SET NAMES utf8mb4 */;
20
21 --
22 -- Database: `sourcecodester_scm_new`
23 --
24
25 -- --------------------------------------------------------
26
27 --
28 -- Table structure
for table `admin`
29 --
30
31 CREATE TABLE `admin` (
32   `id`
int(11) NOT NULL,
33   `username` varchar(
20) NOT NULL,
34   `password` varchar(
20) NOT NULL
35 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
36
37 --
38 -- Dumping data
for table `admin`
39 --
40
41 INSERT INTO `admin` (`id`, `username`, `password`) VALUES
42 (
1, 'admin', 'admin123');
43
44 -- --------------------------------------------------------
45
46 --
47 -- Table structure
for table `area`
48 --
49
50 CREATE TABLE `area` (
51   `area_id`
int(11) NOT NULL,
52   `area_name` varchar(
50) NOT NULL,
53   `area_code` varchar(
10) NOT NULL
54 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
55
56 --
57 -- Dumping data
for table `area`
58 --
59
60 INSERT INTO `area` (`area_id`, `area_name`, `area_code`) VALUES
61 (
1, 'Sarkhej', 'SRKJ'),
62 (
2, 'Vastrapur', 'VSTR'),
63 (
3, 'Maninagar', 'MNGR'),
64 (
4, 'New Ranip', 'NRANIP'),
65 (
5, 'Vejalpur', 'VJLP');
66
67 -- --------------------------------------------------------
68
69 --
70 -- Table structure
for table `categories`
71 --
72
73 CREATE TABLE `categories` (
74   `cat_id`
int(11) NOT NULL,
75   `cat_name` varchar(
25) NOT NULL,
76   `cat_details` text
77 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
78
79 --
80 -- Dumping data
for table `categories`
81 --
82
83 INSERT INTO `categories` (`cat_id`, `cat_name`, `cat_details`) VALUES
84 (
1, 'Fast Food', ''),
85 (
2, 'Bread Buns', ''),
86 (
3, 'Counter Cakes', ''),
87 (
4, 'Deserts', ''),
88 (
5, 'Pastry Rs - 55', ''),
89 (
6, 'Pastry Rs - 60', ''),
90 (
7, 'Pastry Rs - 65', ''),
91 (
8, 'Pastry Rs - 70', ''),
92 (
9, 'Add On Items', ''),
93 (
10, 'Cakes', ''),
94 (
11, 'Cheese Cake', '');
95
96 -- --------------------------------------------------------
97
98 --
99 -- Table structure
for table `distributor`
100 --
101
102 CREATE TABLE `distributor` (
103   `dist_id`
int(11) NOT NULL,
104   `dist_name` varchar(
25) NOT NULL,
105   `dist_email` varchar(
50) DEFAULT NULL,
106   `dist_phone` varchar(
10) NOT NULL,
107   `dist_address` varchar(
200) DEFAULT NULL
108 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
109
110 --
111 -- Dumping data
for table `distributor`
112 --
113
114 INSERT INTO `distributor` (`dist_id`, `dist_name`, `dist_email`, `dist_phone`, `dist_address`) VALUES
115 (
1, 'Nishant Shah', 'nishant45@gmail.com', '8980769792', 'Alpha Mall, Vastrapur, Ahmedabad'),
116 (
2, 'Rahul Pandey', 'rahul431@gmail.com', '9099432197', 'Gota, S.G. Highway, Ahmedabad'),
117 (
3, 'Pawan Panchal', 'pawan.rocks@gmail.com', '7878025437', 'Modhera Stadium, Ahmedabad'),
118 (
4, 'Pushpak Patel', 'pushpak@gmail.com', '9012376544', 'Navrangpura, Ahmedabad'),
119 (
5, 'Haniket Patel', 'hanipatel@gmail.com', '8980745372', 'CTM, Ahmedabad');
120
121 -- --------------------------------------------------------
122
123 --
124 -- Table structure
for table `invoice`
125 --
126
127 CREATE TABLE `invoice` (
128   `invoice_id`
int(11) NOT NULL,
129   `order_id`
int(11) NOT NULL,
130   `retailer_id`
int(11) NOT NULL,
131   `dist_id`
int(11) NOT NULL,
132   `date` date NOT NULL,
133   `total_amount`
decimal(10,3) NOT NULL,
134   `comments` text
135 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
136
137 --
138 -- Dumping data
for table `invoice`
139 --
140
141 INSERT INTO `invoice` (`invoice_id`, `order_id`, `retailer_id`, `dist_id`, `date`, `total_amount`, `comments`) VALUES
142 (
1, 2, 4, 3, '2015-04-28', '5119.500', ''),
143 (
2, 1, 2, 5, '2015-04-28', '4780.150', ''),
144 (
3, 3, 1, 1, '2015-04-28', '8891.680', ''),
145 (
4, 4, 5, 4, '2015-04-28', '7888.960', ''),
146 (
5, 5, 5, 1, '2020-12-07', '8919.880', 'asd');
147
148 -- --------------------------------------------------------
149
150 --
151 -- Table structure
for table `invoice_items`
152 --
153
154 CREATE TABLE `invoice_items` (
155   `invoice_items_id`
int(11) NOT NULL,
156   `invoice_id`
int(11) NOT NULL,
157   `product_id`
int(11) NOT NULL,
158   `quantity`
int(6) NOT NULL
159 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
160
161 --
162 -- Dumping data
for table `invoice_items`
163 --
164
165 INSERT INTO `invoice_items` (`invoice_items_id`, `invoice_id`, `product_id`, `quantity`) VALUES
166 (
1, 1, 4, 20),
167 (
2, 1, 5, 5),
168 (
3, 1, 7, 10),
169 (
4, 1, 9, 10),
170 (
5, 1, 12, 6),
171 (
6, 1, 14, 5),
172 (
7, 2, 1, 20),
173 (
8, 2, 2, 15),
174 (
9, 2, 5, 10),
175 (
10, 2, 8, 5),
176 (
11, 2, 10, 8),
177 (
12, 2, 11, 10),
178 (
13, 2, 13, 2),
179 (
14, 2, 15, 3),
180 (
15, 3, 1, 2),
181 (
16, 3, 2, 4),
182 (
17, 3, 3, 3),
183 (
18, 3, 4, 8),
184 (
19, 3, 5, 10),
185 (
20, 3, 6, 12),
186 (
21, 3, 8, 4),
187 (
22, 3, 11, 10),
188 (
23, 3, 13, 3),
189 (
24, 3, 14, 5),
190 (
25, 3, 15, 6),
191 (
26, 4, 2, 12),
192 (
27, 4, 4, 30),
193 (
28, 4, 8, 4),
194 (
29, 4, 11, 20),
195 (
30, 4, 14, 8);
196
197 -- --------------------------------------------------------
198
199 --
200 -- Table structure
for table `manufacturer`
201 --
202
203 CREATE TABLE `manufacturer` (
204   `man_id`
int(11) NOT NULL,
205   `man_name` varchar(
25) NOT NULL,
206   `man_email` varchar(
50) DEFAULT NULL,
207   `man_phone` varchar(
10) NOT NULL,
208   `username` varchar(
20) NOT NULL,
209   `password` varchar(
20) NOT NULL
210 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
211
212 --
213 -- Dumping data
for table `manufacturer`
214 --
215
216 INSERT INTO `manufacturer` (`man_id`, `man_name`, `man_email`, `man_phone`, `username`, `password`) VALUES
217 (
1, 'Suresh Kumar', 'suresh@gmail.com', '9890234510', 'suresh', 'suresh123'),
218 (
2, 'Ankit Pandya', 'ankitp@gmail.com', '8980956231', 'ankit', 'ankit123'),
219 (
3, 'Paawan Shah', 'paawanshah@gmail.com', '9934672300', 'paawan', 'paawan123'),
220 (
4, 'Jainish Shah', 'jainishshah@gmail.com', '9807634905', 'jainish', 'jainish123'),
221 (
5, 'Krupal Joshi', 'krupal12@yahoo.co.in', '7634507610', 'krupal', 'krupal123'),
222 (
6, 'janobe sourcecode', 'janobe@gmail.com', '9876565421', 'janobe', 'janobe');
223
224 -- --------------------------------------------------------
225
226 --
227 -- Table structure
for table `orders`
228 --
229
230 CREATE TABLE `orders` (
231   `order_id`
int(11) NOT NULL,
232   `date` date NOT NULL,
233   `retailer_id`
int(11) NOT NULL,
234   `approved` tinyint(
1) NOT NULL,
235   `status` tinyint(
1) NOT NULL,
236   `total_amount`
decimal(10,3) NOT NULL
237 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
238
239 --
240 -- Dumping data
for table `orders`
241 --
242
243 INSERT INTO `orders` (`order_id`, `date`, `retailer_id`, `approved`, `status`, `total_amount`) VALUES
244 (
1, '2015-04-28', 2, 1, 1, '4780.150'),
245 (
2, '2015-04-28', 4, 1, 1, '5119.500'),
246 (
3, '2015-04-28', 1, 1, 1, '8891.680'),
247 (
4, '2015-04-28', 5, 1, 1, '7888.960'),
248 (
5, '2015-04-28', 5, 1, 0, '8919.880'),
249 (
6, '2020-12-07', 1, 0, 0, '50.010');
250
251 -- --------------------------------------------------------
252
253 --
254 -- Table structure
for table `order_items`
255 --
256
257 CREATE TABLE `order_items` (
258   `order_items_id`
int(11) NOT NULL,
259   `order_id`
int(11) NOT NULL,
260   `pro_id`
int(11) NOT NULL,
261   `quantity`
int(6) NOT NULL
262 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
263
264 --
265 -- Dumping data
for table `order_items`
266 --
267
268 INSERT INTO `order_items` (`order_items_id`, `order_id`, `pro_id`, `quantity`) VALUES
269 (
1, 1, 1, 20),
270 (
2, 1, 2, 15),
271 (
3, 1, 5, 10),
272 (
4, 1, 8, 5),
273 (
5, 1, 10, 8),
274 (
6, 1, 11, 10),
275 (
7, 1, 13, 2),
276 (
8, 1, 15, 3),
277 (
9, 2, 4, 20),
278 (
10, 2, 5, 5),
279 (
11, 2, 7, 10),
280 (
12, 2, 9, 10),
281 (
13, 2, 12, 6),
282 (
14, 2, 14, 5),
283 (
15, 3, 1, 2),
284 (
16, 3, 2, 4),
285 (
17, 3, 3, 3),
286 (
18, 3, 4, 8),
287 (
19, 3, 5, 10),
288 (
20, 3, 6, 12),
289 (
21, 3, 8, 4),
290 (
22, 3, 11, 10),
291 (
23, 3, 13, 3),
292 (
24, 3, 14, 5),
293 (
25, 3, 15, 6),
294 (
26, 4, 2, 12),
295 (
27, 4, 4, 30),
296 (
28, 4, 8, 4),
297 (
29, 4, 11, 20),
298 (
30, 4, 14, 8),
299 (
31, 5, 1, 1),
300 (
32, 5, 2, 3),
301 (
33, 5, 3, 5),
302 (
34, 5, 4, 15),
303 (
35, 5, 6, 30),
304 (
36, 5, 8, 45),
305 (
37, 5, 12, 20),
306 (
38, 5, 14, 5),
307 (
39, 6, 1, 1),
308 (
40, 6, 2, 2);
309
310 -- --------------------------------------------------------
311
312 --
313 -- Table structure
for table `products`
314 --
315
316 CREATE TABLE `products` (
317   `pro_id`
int(11) NOT NULL,
318   `pro_name` varchar(
25) NOT NULL,
319   `pro_desc` text,
320   `pro_price`
decimal(10,3) NOT NULL,
321   `unit`
int(11) NOT NULL,
322   `pro_cat`
int(11) NOT NULL,
323   `quantity`
int(6) DEFAULT NULL
324 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
325
326 --
327 -- Dumping data
for table `products`
328 --
329
330 INSERT INTO `products` (`pro_id`, `pro_name`, `pro_desc`, `pro_price`, `unit`, `pro_cat`, `quantity`) VALUES
331 (
1, 'Butter Puff', '', '16.670', 2, 1, NULL),
332 (
2, 'Corn Puff', '', '16.670', 2, 1, NULL),
333 (
3, 'Garlic Cheese Roll', '', '39.570', 2, 1, NULL),
334 (
4, 'Butter Stuffed Bun', '', '42.000', 2, 1, NULL),
335 (
5, 'Paneer Tikka S. Bun', '', '52.500', 2, 1, NULL),
336 (
6, 'Burger Bun 4 PCS', '', '42.000', 2, 2, NULL),
337 (
7, 'Hot Dog Bun 4 PCS', '', '46.000', 2, 2, NULL),
338 (
8, 'Garlic Lauf', '', '47.230', 2, 2, NULL),
339 (
9, 'Dabeli Bun 12 PCS', '', '48.500', 2, 2, NULL),
340 (
10, 'Pizza Base 4 PCS', '', '35.650', 2, 2, NULL),
341 (
11, 'Pizza Sauce', '', '120.000', 1, 9, 60),
342 (
12, 'Sweet Onion Sauce', '', '112.000', 1, 9, 74),
343 (
13, 'Strawberry Cake 1 KG', '', '381.670', 1, 3, NULL),
344 (
14, 'Choco Chips Cake 1 KG', '', '480.000', 1, 3, NULL),
345 (
15, 'Belgium Cake 1 KG', '', '395.670', 1, 3, NULL),
346 (
16, 'soup 34', 'asd', '23.000', 2, 5, 0);
347
348 -- --------------------------------------------------------
349
350 --
351 -- Table structure
for table `retailer`
352 --
353
354 CREATE TABLE `retailer` (
355   `retailer_id`
int(11) NOT NULL,
356   `username` varchar(
25) NOT NULL,
357   `password` varchar(
25) NOT NULL,
358   `address` varchar(
200) NOT NULL,
359   `area_id`
int(11) NOT NULL,
360   `phone` varchar(
10) NOT NULL,
361   `email` varchar(
50) DEFAULT NULL
362 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
363
364 --
365 -- Dumping data
for table `retailer`
366 --
367
368 INSERT INTO `retailer` (`retailer_id`, `username`, `password`, `address`, `area_id`, `phone`, `email`) VALUES
369 (
1, 'altaf', 'altaf123', 'A4 Ali Abad Appt, Kajal Park Soci, Sarkhej Road, Ahmedabad', 1, '9978454323', 'altafneva@gmail.com'),
370 (
2, 'nayan', 'nayan123', 'Opp. Shivalik Complex, Vastrapur, Ahmedabad', 2, '9898906523', 'nayan@gmail.com'),
371 (
3, 'nishit', 'nishit123', 'B/H Kakariya Lake, Maninagar, Ahmedabad', 3, '8980941941', 'nishit@gmail.com'),
372 (
4, 'dharmil', 'dharmil123', 'Near Vejalpur Police Station, Vejalpur, Ahmedabad', 5, '7865340091', 'dharmil123@gmail.com'),
373 (
5, 'rajesh', 'rajesh123', 'C4-Pushpak Complex, New Ranip, Ahmedabad', 4, '7898902365', 'rajesh123@gmail.com');
374
375 -- --------------------------------------------------------
376
377 --
378 -- Table structure
for table `unit`
379 --
380
381 CREATE TABLE `unit` (
382   `id`
int(11) NOT NULL,
383   `unit_name` varchar(
20) NOT NULL,
384   `unit_details` text
385 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
386
387 --
388 -- Dumping data
for table `unit`
389 --
390
391 INSERT INTO `unit` (`id`, `unit_name`, `unit_details`) VALUES
392 (
1, 'KG', 'Kilo Gram'),
393 (
2, 'PCS', 'Pieces'),
394 (
3, 'LTR', 'Litre');
395
396 --
397 -- Indexes
for dumped tables
398 --
399
400 --
401 -- Indexes
for table `admin`
402 --
403 ALTER TABLE `admin`
404   ADD PRIMARY KEY (`id`);
405
406 --
407 -- Indexes
for table `area`
408 --
409 ALTER TABLE `area`
410   ADD PRIMARY KEY (`area_id`);
411
412 --
413 -- Indexes
for table `categories`
414 --
415 ALTER TABLE `categories`
416   ADD PRIMARY KEY (`cat_id`);
417
418 --
419 -- Indexes
for table `distributor`
420 --
421 ALTER TABLE `distributor`
422   ADD PRIMARY KEY (`dist_id`);
423
424 --
425 -- Indexes
for table `invoice`
426 --
427 ALTER TABLE `invoice`
428   ADD PRIMARY KEY (`invoice_id`),
429   ADD KEY `order_id` (`order_id`),
430   ADD KEY `retailer_id` (`retailer_id`),
431   ADD KEY `dist_id` (`dist_id`);
432
433 --
434 -- Indexes
for table `invoice_items`
435 --
436 ALTER TABLE `invoice_items`
437   ADD PRIMARY KEY (`invoice_items_id`),
438   ADD KEY `invoice_id` (`invoice_id`),
439   ADD KEY `product_id` (`product_id`);
440
441 --
442 -- Indexes
for table `manufacturer`
443 --
444 ALTER TABLE `manufacturer`
445   ADD PRIMARY KEY (`man_id`);
446
447 --
448 -- Indexes
for table `orders`
449 --
450 ALTER TABLE `orders`
451   ADD PRIMARY KEY (`order_id`),
452   ADD KEY `retailer_id` (`retailer_id`);
453
454 --
455 -- Indexes
for table `order_items`
456 --
457 ALTER TABLE `order_items`
458   ADD PRIMARY KEY (`order_items_id`),
459   ADD KEY `order_id` (`order_id`),
460   ADD KEY `pro_id` (`pro_id`);
461
462 --
463 -- Indexes
for table `products`
464 --
465 ALTER TABLE `products`
466   ADD PRIMARY KEY (`pro_id`),
467   ADD KEY `unit` (`unit`),
468   ADD KEY `pro_cat` (`pro_cat`);
469
470 --
471 -- Indexes
for table `retailer`
472 --
473 ALTER TABLE `retailer`
474   ADD PRIMARY KEY (`retailer_id`),
475   ADD KEY `area_code` (`area_id`),
476   ADD KEY `area_id` (`area_id`),
477   ADD KEY `area_id_2` (`area_id`),
478   ADD KEY `area_id_3` (`area_id`),
479   ADD KEY `area_id_4` (`area_id`);
480
481 --
482 -- Indexes
for table `unit`
483 --
484 ALTER TABLE `unit`
485   ADD PRIMARY KEY (`id`);
486
487 --
488 -- AUTO_INCREMENT
for dumped tables
489 --
490
491 --
492 -- AUTO_INCREMENT
for table `admin`
493 --
494 ALTER TABLE `admin`
495   MODIFY `id`
int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
496
497 --
498 -- AUTO_INCREMENT
for table `area`
499 --
500 ALTER TABLE `area`
501   MODIFY `area_id`
int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
502
503 --
504 -- AUTO_INCREMENT
for table `categories`
505 --
506 ALTER TABLE `categories`
507   MODIFY `cat_id`
int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
508
509 --
510 -- AUTO_INCREMENT
for table `distributor`
511 --
512 ALTER TABLE `distributor`
513   MODIFY `dist_id`
int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
514
515 --
516 -- AUTO_INCREMENT
for table `invoice`
517 --
518 ALTER TABLE `invoice`
519   MODIFY `invoice_id`
int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
520
521 --
522 -- AUTO_INCREMENT
for table `invoice_items`
523 --
524 ALTER TABLE `invoice_items`
525   MODIFY `invoice_items_id`
int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=39;
526
527 --
528 -- AUTO_INCREMENT
for table `manufacturer`
529 --
530 ALTER TABLE `manufacturer`
531   MODIFY `man_id`
int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
532
533 --
534 -- AUTO_INCREMENT
for table `orders`
535 --
536 ALTER TABLE `orders`
537   MODIFY `order_id`
int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
538
539 --
540 -- AUTO_INCREMENT
for table `order_items`
541 --
542 ALTER TABLE `order_items`
543   MODIFY `order_items_id`
int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;
544
545 --
546 -- AUTO_INCREMENT
for table `products`
547 --
548 ALTER TABLE `products`
549   MODIFY `pro_id`
int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
550
551 --
552 -- AUTO_INCREMENT
for table `retailer`
553 --
554 ALTER TABLE `retailer`
555   MODIFY `retailer_id`
int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
556
557 --
558 -- AUTO_INCREMENT
for table `unit`
559 --
560 ALTER TABLE `unit`
561   MODIFY `id`
int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
562
563 --
564 -- Constraints
for dumped tables
565 --
566
567 --
568 -- Constraints
for table `invoice`
569 --
570 ALTER TABLE `invoice`
571   ADD CONSTRAINT `invoice_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`order_id`) ON UPDATE CASCADE,
572   ADD CONSTRAINT `invoice_ibfk_2` FOREIGN KEY (`retailer_id`) REFERENCES `retailer` (`retailer_id`) ON UPDATE CASCADE,
573   ADD CONSTRAINT `invoice_ibfk_3` FOREIGN KEY (`dist_id`) REFERENCES `distributor` (`dist_id`) ON UPDATE CASCADE;
574
575 --
576 -- Constraints
for table `invoice_items`
577 --
578 ALTER TABLE `invoice_items`
579   ADD CONSTRAINT `invoice_items_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoice` (`invoice_id`) ON UPDATE CASCADE,
580   ADD CONSTRAINT `invoice_items_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`pro_id`) ON UPDATE CASCADE;
581
582 --
583 -- Constraints
for table `orders`
584 --
585 ALTER TABLE `orders`
586   ADD CONSTRAINT `orders_ibfk_1` FOREIGN KEY (`retailer_id`) REFERENCES `retailer` (`retailer_id`) ON UPDATE CASCADE;
587
588 --
589 -- Constraints
for table `order_items`
590 --
591 ALTER TABLE `order_items`
592   ADD CONSTRAINT `order_items_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`order_id`) ON UPDATE CASCADE,
593   ADD CONSTRAINT `order_items_ibfk_2` FOREIGN KEY (`pro_id`) REFERENCES `products` (`pro_id`) ON UPDATE CASCADE;
594
595 --
596 -- Constraints
for table `products`
597 --
598 ALTER TABLE `products`
599   ADD CONSTRAINT `products_ibfk_1` FOREIGN KEY (`unit`) REFERENCES `unit` (`id`) ON UPDATE CASCADE,
600   ADD CONSTRAINT `products_ibfk_2` FOREIGN KEY (`pro_cat`) REFERENCES `categories` (`cat_id`) ON UPDATE CASCADE;
601
602 --
603 -- Constraints
for table `retailer`
604 --
605 ALTER TABLE `retailer`
606   ADD CONSTRAINT `retailer_ibfk_1` FOREIGN KEY (`area_id`) REFERENCES `area` (`area_id`);
607 COMMIT;

608
609 /*!
40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
610 /*!
40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
611 /*!
40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


Gõ tìm kiếm nhanh...